<?php
 
include_once (__DIR__ . '/../dao/restitutionZoneDao.php');
include_once (__DIR__ . '/../utils/requestUtils.php');

class RestitutionZoneServices {

    public function __construct() {
    }

    function create($operator, $zone, $reference,$actif) {
        $connection = new DBConnection();
        $connection->connect();
        $dao = new RestitutionZoneDao($connection);
        $r = $dao->create(
                $operator, escapeInput($connection->getConnection(), $zone), $reference,$actif);
        $connection->close();
        return $r;
    }
    
    function update($id, $zone, $reference,$actif) {
        $connection = new DBConnection();
        $connection->connect();
        $dao = new RestitutionZoneDao($connection);
        $r = $dao->update($id, escapeInput($connection->getConnection(), $zone), $reference,$actif);
        $connection->close();
        return $r;
    }

    function getZonesByOperator($operator) {
        $connection = new DBConnection();
        $connection->connect();
        $dao = new RestitutionZoneDao($connection);
        $r = $dao->getZonesByOperator($operator);
        $connection->close();
        return $r;
    }

}
